﻿<%@ Page Language="C#" %>

<%
    // Project: Salient
    // http://salient.codeplex.com
    // 
    // Date: April 24 2010 

%>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Request["loggedout"] != null)
        {
            Label3.Text = "You were ejected from a protected resource by " + Request["loggedout"];
        }

        // notice we are not calling Session.Abandon()...

        Label1.Text = "Your FormsAuthentication ticket is " + (Request.IsAuthenticated ? "NOT " : "") + "expired.";
        Label2.Text = Session.IsNewSession ? "Your ASP session expired. An empty session has been initialized." : "Your ASP session is still active.";
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        // if nothing is put into the session, no session ticket is issued. 

        // simulate a meaningful action and stuff something into the session to initialize the session id.
        Session["__________SessionKicker"] = DateTime.Now;

        Response.Redirect("SessionAuthenticated.aspx");
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("FormsAuthenticated.aspx");
    }
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="Demo.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="style1">
        <asp:LoginName ID="LoginName1" runat="server" />
        <asp:LoginStatus ID="LoginStatus1" runat="server" />
    </div>
    <h3>
        SessionAuditorModule</h3>
    <h4>
        A strategy for real-time asyncronous session state/lifetime polling.</h4>
    <div class="style1">
        <p>
            Tested in:</p>
        <ul>
            <li>Internet Explorer 8 win</li>
            <li>Safari 4 win</li>
            <li>Firefox 3.5 win</li>
            <li>Chrome 4 win</li>
            <li>Opera 10.10 win</li>
        </ul>
    </div>
    <p>
        <asp:Label ID="Label3" runat="server" Text=""></asp:Label>
    </p>
    <fieldset class="style1">
        <legend>Forms Authentication</legend>
        <p>
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label></p>
        <asp:Button ID="Button2" runat="server" Text="Access FormsAuthentication protected resource"
            OnClick="Button2_Click" />
    </fieldset>
    <p>
        &nbsp;</p>
    <fieldset class="style1">
        <legend>ASP Session</legend>
        <p>
            <asp:Label ID="Label2" runat="server" Text=""></asp:Label></p>
        <asp:Button ID="Button1" runat="server" Text="Access session protected resource"
            OnClick="Button1_Click" />
    </fieldset>
    </form>
</body>
</html>
